﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using ConnectionControl;
using Usermanagment.DBConnection;

namespace pokerServer.ProtHandlers.Concrete
{
	class PlayerStatRequest : IProtHandle
	{
		private DBConnect dbc;
		private ClientConnection cc;

		public PlayerStatRequest(ClientConnection cc)
		{
			this.cc = cc;
			this.dbc = this.cc.getDBC();
		}



		public string work()
		{
			DBDatafetch dft = new DBDatafetch(this.dbc);
			String s = "Statistics ";
			using (DataTable db = dft.getAllData("playerstat"))
			{
			
				for(int i = 0 ; i < db.Rows.Count ; i++)
				{
					String t = "<";
					for(int j = 0 ; j < db.Columns.Count ;  j++)
					{
						t+=db.Rows[i][j]+" ";
					}
					t+=">";
					s+=t;
				}

			}
			return s;
		}
	}
}
